{smcl}
{* *! covtest v0.3 2019-01-03}{...}
{viewerjumpto "Syntax" "covtest##syntax"}{...}
{viewerjumpto "Description" "covtest##description"}{...}
{viewerjumpto "Options" "covtest##options"}{...}
{viewerjumpto "Examples" "covtest##examples"}{...}
{viewerjumpto "Author" "covtest##contact"}{...}
{viewerjumpto "References" "covtest##references"}{...}
{title:Title}

{p2colset 5 18 20 2}{...}
{p2col :{cmd:covtest} {hline 2}}Two-sample comparison of covariance between two variables using groups{p_end}
{p2colreset}{...}

{marker syntax}{...}
{title:Syntax}
{p 8 15 2} {cmd:covtest}
{it:{help varname:varname1}} {it:{help varname:varname2}}
{ifin} {cmd:,} {opth by(groupvar)} [{help covtest##options:options}] {p_end}

{marker opt_summary}{...}
{synoptset 22 tabbed}{...}
{synopthdr}
{synoptline}
{p2coldent:* {opth by(groupvar)}}variable defining the groups{p_end}
{synopt: {opth l:evel(level:cilevel)}}confidence level between 10.00 and 99.99{p_end}	

{marker description}{...}
{title:Description}

{pstd}
{cmd:covtest} is a test to compare the covariance between two variables with two groups. It also reports the result of a test of correlations between the two variables with the two groups.{p_end}

{pstd}
For a description of the test, see Yu, Zhang & Zuo (2019).{p_end}

{marker options}{...}
{title:Options}

{phang}
{opth by(groupvar)} specifies the {it:groupvar} that defines the two groups that {cmd:covtest} will use to test the hypothesis that the covariance between {it:varname1} and {it:varname2} are equal in both groups. {it:groupvar} must be a
categorical variable with two levels {bf:0} and {bf:1}. Specifying {bf:by} is required.

{phang}
{opth l:evel(level:cilevel)} overrides {it:c(level)} and sets confidence level. 

{marker examples}{...}
{title:Examples}

{pstd}Setup{p_end}
{phang2}{cmd:. sysuse auto}{p_end}

{pstd}
Test equality of covariance and correlation of {bf:price} and {bf:mpg} grouped by {bf:foreign}{p_end}
{phang2}{cmd:.  covtest price mpg, by(foreign)}{p_end}

{text}Test equality of covariance and correlation of {bf:price} and {bf:mpg} grouped by {bf:foreign}
{text}{hline 12}{c TT}{hline 69}{c TT}{hline 23}
{text}{space 12}{c |}{ralign 6:Obs}  {ralign 11:Covariance} {ralign 11:Std. Err.}{ralign 11:p-value}{ralign 26:[95% Conf. Interval]} {c |} {ralign 11:Correlation}{ralign 11:p-value}
{hline 12}{c +}{hline 69}{c +}{hline 23}
{text}{ralign 10:0.foreign}  {c |}{result}    52     -7407.87     2047.15    .000296     -11420.2     -3395.53 {c |}    -.504263    .000102   
{text}{ralign 10:1.foreign}  {c |}{result}    22       -10943     3955.08    .005661     -18694.8     -3191.17 {c |}    -.631303     .00119   
{text}{hline 12}{c +}{hline 69}{c +}{hline 23}
{text}{ralign 10:diff}  {c |}{result}    74      3535.11     4453.48    .427319     -5193.54      12263.8 {c |}      .12704    .485334   
{text}{hline 12}{c BT}{hline 69}{c BT}{hline 23}

{marker contact}{...}
{title:Author}

{pstd}Glen K. L. Ng{break}
Hong Kong University of Science and Technology{break}
Email: {browse "mailto:klngag@connect.ust.hk":klngag@connect.ust.hk}
{p_end}

{marker references}{...}
{title:References}

{phang}
Chi Wai Yu, Y. Jane Zhang, and Sharon Xuejing Zuo. "Multiple Switching and Data Quality in the Multiple Price List".
{it:Review of Economics and Statistics, conditionally accepted, 2019.}
{p_end}
